#include<iostream>
#include<vector>
#include<algorithm>
#include<unordered_map>
using namespace std;
typedef long long ll;

void solve(){
    int n,k,t;
    cin>>n>>k;
    unordered_map<int,int> mp;
    for(int i=0;i<n;i++){
        cin>>t;
        if(t<=k)mp[t]++;
    }
    int has=0;
    for(auto [x,cnt]:mp){
        if(x<k)has++;
    }
    int need=k-has;
    if(need==0 && mp[k]==0){
        cout<<0<<'\n';
        return;
    }
    if(need==0){
        cout<<mp[k]<<'\n';
        return;
    }
    cout<<max(mp[k],need)<<'\n';
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    int t=1;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}